import Vue from 'vue'
import VueRouter from 'vue-router'
// import logIn from '@/views/LogIn'

Vue.use(VueRouter)

const routes = [
  //二级路由里一定包含一级路由的路径
  {
    path: '/',
    redirect: '/ ',
    component: () => import('@/views/layout'),
    children: [
      //子路由的path，如果不加 / ，自动将父级路由path和自己进行拼接
      //加 / ，不会拼接
      {
        path: '/ ',
        component: () => import('@/views/Home/Home')
      },
      {
        path: '/video',
        component: () => import(/*webpackChunkName:'base'*/'@/views/Video/Video')
      },
      {
        path: '/qa',
        component: () => import(/*webpackChunkName:'base'*/'@/views/QA/QA')
      },
      {
        path: '/profile',
        component: () => import('@/views/My/My')
      }
    ]
  },
  {
    path: '/login',
    component: () => import(/*webpackChunkName:'login'*/'@/views/LogIn')
  },
  {
    path: '/search',
    component: () => import('@/views/Search')
  },
  {
    path: '/user',
    component: () => import('@/views/User')
  }
]

const router = new VueRouter({
  routes
})

export default router
